package com.voxel.sense.infomsg.widget;

import android.app.Dialog;
import android.content.Context;

import com.voxel.sense.infomsg.R;
import com.warkiz.widget.IndicatorSeekBar;

public class ProgressDialogs extends Dialog{
  private Dialog dialog;
  IndicatorSeekBar progressBar;

  public ProgressDialogs(Context context) {
    super(context);
    this.dialog = dialog = new Dialog(context, R.style.remind_dialog);
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setContentView(R.layout.dialog_update_progress);
    progressBar = dialog.findViewById(R.id.progress);
    progressBar.setMin(0f);
    progressBar.setEnabled(false);
  }


  public void setProgress(int progress, int total) {
    progressBar.setProgress((((progress / total) * 100)));
    progressBar.setIndicatorTextFormat("${PROGRESS} %");

  }

  public void  setProgressMax(int max) {
    progressBar.setMax(100f);
  }

  public void show() {
    if (!dialog.isShowing()) {
      dialog.show();
    }
  }

  public void dismiss() {
    if (dialog.isShowing()) {
      dialog.dismiss();
    }
  }
}